<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1.25" charset="UTF-8">
    <title>Category List</title>
    <link rel="StyleSheet" href="/css/jpetstore.css" type="text/css" media="screen"/>
</head>
<body>
<header th:replace="common/top"></header>
<div id="Content">
    <div id="BackLink">
        <a href="/catalog/view">Return to Main Menu</a>
    </div>
    <h2>Category Management</h2>
<!--    <a th:href="@{/admin/category/edit}">Add New Category</a>-->
    <table>
        <tr>
            <th>Category ID</th>
            <th>Name</th>
            <th>Description</th>
            <th>Actions</th>
        </tr>
        <tr th:each="cat : ${categories}">
            <td th:text="${cat.categoryId}"></td>
            <td th:text="${cat.name}"></td>
            <td th:text="${cat.description}"></td>
            <td>
                <a th:href="@{/catalog/AdminAddCategory(categoryId=${cat.categoryId})}">Edit</a>
                <a th:href="@{/catalog/delete(categoryId=${cat.categoryId})}" onclick="return confirm('Are you sure?');">Delete</a>
            </td>
        </tr>
    </table>
</div>
<footer th:replace="common/bottom"></footer>

<!--脚本-->
<script th:src="@{/js/background.js}" count="500"></script>
</body>
</html>
